Properties

$default_charset

$default_charset

Methods

__construct()

__construct(mixed  $default_charset = null) : mixed

Object constructor.

Parameters

mixed $default_charset

Returns

mixed —

get_charset()

get_charset() : string

Returns message/object character set name

Returns

string —

Character set name

parse_message()

parse_message(string  $raw_body) : object

Parse the given raw message source and return a structure of rcube_message_part objects.

It makes use of the rcube_mime_decode library

Parameters

string $raw_body

The message source

Returns

object —

rcube_message_part The message structure

decode_address_list()

decode_address_list(string|array  $input, int  $max = null, bool  $decode = true, string  $fallback = null, bool  $addronly = false) : array

Split an address list into a structured array list

Parameters

string|array $input

Input string (or list of strings)

int $max

List only this number of addresses

bool $decode

Decode address strings

string $fallback

Fallback charset if none specified

bool $addronly

Return flat array with e-mail addresses only

Returns

array —

Indexed list of addresses

decode_header()

decode_header(string  $input, string  $fallback = null) : string

Decode a message header value

Parameters

string $input

Header value

string $fallback

Fallback charset if none specified

Returns

string —

Decoded string

decode_mime_string()

decode_mime_string(string  $input, string  $fallback = null) : string

Decode a mime-encoded string to internal charset

Parameters

string $input

Header value

string $fallback

Fallback charset if none specified

Returns

string —

Decoded string

decode()

decode(string  $input, string  $encoding = '7bit') : string

Decode a mime part

Parameters

string $input

Input string

string $encoding

Part encoding

Returns

string —

Decoded string

parse_headers()

parse_headers(mixed  $headers) : mixed

Split RFC822 header string into an associative array

Parameters

mixed $headers

Returns

mixed —

explode_header_string()

explode_header_string(string  $separator, string  $str, bool  $remove_comments = false) : array

Explodes header (e.g. address-list) string into array of strings using specified separator characters with proper handling of quoted-strings and comments (RFC2822)

Parameters

string $separator

String containing separator characters

string $str

Header string

bool $remove_comments

Enable to remove comments

Returns

array —

Header items

unfold_flowed()

unfold_flowed(string  $text, string  $mark = null, bool  $delsp = false) : string

Interpret a format=flowed message body according to RFC 2646

Parameters

string $text

Raw body formatted as flowed text

string $mark

Mark each flowed line with specified character

bool $delsp

Remove the trailing space of each flowed line

Returns

string —

Interpreted text with unwrapped lines and stuffed space removed

format_flowed()

format_flowed(string  $text, int  $length = 72, string  $charset = null) : string

Wrap the given text to comply with RFC 2646

Parameters

string $text

Text to wrap

int $length

Length

string $charset

Character encoding of $text

Returns

string —

Wrapped text

wordwrap()

wordwrap(string  $string, int  $width = 75, string  $break = "
", bool  $cut = false, string  $charset = null, bool  $wrap_quoted = true) : string

Improved wordwrap function with multibyte support.

The code is based on Zend_Text_MultiByte::wordWrap().

Parameters

string $string

Text to wrap

int $width

Line width

string $break

Line separator

bool $cut

Enable to cut word

string $charset

Charset of $string

bool $wrap_quoted

When enabled quoted lines will not be wrapped

Returns

string —

Text

file_content_type()

file_content_type(string  $path, string  $name, string  $failover = 'application/octet-stream', bool  $is_stream = false, bool  $skip_suffix = false) : string

A method to guess the mime_type of an attachment.

Parameters

string $path

Path to the file or file contents

string $name

File name (with suffix)

string $failover

Mime type supplied for failover

bool $is_stream

Set to True if $path contains file contents

bool $skip_suffix

Set to True if the config/mimetypes.php map should be ignored

Returns

string —

file_ext_type()

file_ext_type(string  $filename) : string|null

File type detection based on file name only.

Parameters

string $filename

Path to the file or file contents

Returns

string|null —

Mimetype label

get_mime_extensions()

get_mime_extensions(mixed  $mimetype = null) : array

Get mimetype => file extension mapping

Parameters

mixed $mimetype

Returns

array —

List of extensions matching the given mimetype or a hash array with ext -> mimetype mappings if $mimetype is not given

image_content_type()

image_content_type(string  $data) : string

Detect image type of the given binary data by checking magic numbers.

Parameters

string $data

Binary file content

Returns

string —

Detected mime-type or jpeg as fallback

fix_email()

fix_email(mixed  $email) : mixed

Try to fix invalid email addresses

Parameters

mixed $email

Returns

mixed —

fix_mimetype()

fix_mimetype(string  $type) : string

Fix mimetype name.

Parameters

string $type

Mimetype

Returns

string —

Mimetype

parse_address_list()

parse_address_list(mixed  $str, mixed  $decode = true, mixed  $fallback = null) : mixed

E-mail address list parser

Parameters

mixed $str
mixed $decode
mixed $fallback

Returns

mixed —